<%@ page import="com.hotel.entity.Member" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/hotel/style/style.css"></link>
    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(to right, #e0f7fa, #80deea);
        }

        #container {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }

        #header ul, #menu ul {
            list-style: none;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: flex-end;
            background-color: #006064;
        }

        #header ul li, #menu ul li {
            padding: 10px 15px;
        }

        #header ul li a, #menu ul li a {
            color: white;
            text-decoration: none;
            font-weight: bold;
        }

        #header ul li a:hover, #menu ul li a:hover {
            text-decoration: underline;
        }

        #content {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 400px;
        }

        .login {
            background-color: #ffffff;
            border-radius: 10px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
            padding: 30px 20px;
            width: 100%;
            max-width: 360px;
        }

        table {
            width: 100%;
        }

        td {
            padding: 10px 5px;
        }

        label {
            display: inline-block;
            width: 80px;
            font-weight: bold;
        }

        input.field {
            width: 100%;
            padding: 8px;
            box-sizing: border-box;
            border: 1px solid #b0bec5;
            border-radius: 4px;
        }

        .buttons {
            margin-top: 20px;
            text-align: center;
        }

        .buttons input[type="submit"],
        .buttons input[type="button"] {
            padding: 8px 20px;
            margin: 5px;
            background-color: #00838f;
            border: none;
            border-radius: 4px;
            color: white;
            font-weight: bold;
            cursor: pointer;
        }

        .buttons input[type="submit"]:hover,
        .buttons input[type="button"]:hover {
            background-color: #006064;
        }

        span {
            display: inline-block;
            margin-bottom: 10px;
        }

        hr {
            margin-top: 50px;
            border: none;
            border-top: 1px solid #ccc;
        }

        #footer {
            text-align: center;
            padding: 20px;
            font-size: 0.9em;
            color: #666;
        }
    </style>

    <title>腾达宾馆</title>
</head>
<body>
<div id="container">
    <div id="header">
        <ul>
            <li><a href="#">帮助</a></li>
        </ul>
    </div>
    <div id="menu">
        <ul>
            <li><a href="<%=request.getContextPath()%>/hotel/index.jsp">首页</a></li>
            <li><a href="<%=request.getContextPath()%>/list.book">图书列表</a></li>
            <li><a href="<%=request.getContextPath()%>/list.subscription">会员中心</a></li>
        </ul>
    </div>
    <div id="content">
        <div class="login">
            <%
                Member member=(Member) session.getAttribute("member");
                if (member==null){
            %>
            <form action="<%=request.getContextPath()%>/login2.member" method="post">
                <table>
                    <tr>
                        <td>
                            <label for="username">用户名</label>
                        </td>
                        <td>
                            <input type="text" name="username" id="username" class="field"/>
                            <%
                                String msg=(String)request.getAttribute("msg");
                                if(msg!=null){
                            %>
                            <br><span style="color: red;"><%=msg%></span>
                            <%
                                }
                            %>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="password">密码</label>
                        </td>
                        <td>
                            <input type="text" name="password" id="password"  class="field"/>
                        </td>
                    </tr>
                </table>
                <div class="buttons">
                    <input type="submit" value="登录" />
                    <input type="button" value="注册" onclick="location='<%=request.getContextPath()%>/hotel/register-1.jsp'"/>
                </div>
            </form>
            <%
                }else{
            %>
                <div class="buttons">
                    <span style="color: green;">当前用户：<%=member.getUsername()%></span>
                    <input type="button" value="注销" onclick="location='<%=request.getContextPath()%>/logout.member'"/>
                </div>
            <%
                }
            %>
        </div>


    </div>
    <hr />
    <div id="footer">
    </div>
</div>
</body>
</html>